
/**
 * 修改设计的JS文件(整车平台、零部件库、我的零部件库)
 */

$(document).ready(function(){
	fontStyleControl();//字体颜色控制	
	imgSelectControl();//图片选中样式控制
});

function fontStyleControl(){
	$(".fontBox a").on("click",function(){
		var thisItem=$(this);
		if(!(thisItem.hasClass("activeFont"))){
			thisItem.addClass("activeFont");
			thisItem.siblings().removeClass("activeFont");
		}
		
	});
}

function imgSelectControl(){
	
	$(".listImgBox .leftImgBlock").unbind( "click" );
	
	$(".listImgBox .leftImgBlock").on("click",function(){
		var thisItem=$(this);
		
		if(!(thisItem.hasClass("activeImg"))){
			thisItem.addClass("activeImg");
			thisItem.siblings().removeClass("activeImg");
		}
		
		var str=thisItem.find("input").val();
		var car = eval('(' + str + ')'); 
 
		if(car.carid==null){
	 		$("#carsidepic_img").attr('src',FILESERVER_PATH+"?id="+car.carsidepic);
			$("#carfrontpic_img").attr('src',FILESERVER_PATH+"?id="+car.carfrontpic);
			$("#carafterpic_img").attr('src',FILESERVER_PATH+"?id="+car.carafterpic); 
		}
 
		$("#carid").val(car.id);
		$("#name").val(car.name);
		$("#cartype").val(car.cartype);
 
		$("#comment").val(car.comment);
		$("#carType").html(car.cartypeName);
 		$(".rightForm-carColor:nth-child("+car.carcorlor+")").click();
		$("#licence").val(car.licence);
		$("#length").val(car.length);
		$("#width").val(car.width);
		$("#heigh").val(car.heigh);
		
		$("#length_deci").val(car.length/100);
		$("#width_deci").val(car.width/100);
		$("#heigh_deci").val(car.heigh/100);
		
		$("#wheelbase").val(car.wheelbase);
		$("#tread").val(car.tread);
		$("#track").val(car.track);
		
		$("#wheelbase_deci").val(car.wheelbase/100);
		$("#tread_deci").val(car.tread/100);
		$("#track_deci").val(car.track/100);
 
 
	});
}





